import request from "@/utils/request"

const url = '/oShoppingCart'

// 添加商品至购物车
export function add2CartAPI({ productId, skuId }) {
    return request({
        url: `${url}/addCart`,
        params: {
            productId,
            skuId
        }
    })
}

// 获取当前用户的购物车
export function getUserShopCartAPI() {
    return request({
        url: `${url}/findCart`
    })
}

// 更新购物车中商品数量
export function updateProductNumAPI({ id, num }) {
    return request({
        url: `${url}/updateNumber`,
        method: 'POST',
        data: {
            id,
            num
        }
    })
}